import { getHospitalItem } from '@/api/hospitalList/HospitalList'
import { HospitalSh, bookingRule } from '@/api/hospitalList/model/HospitalListType'
import { Card, Descriptions } from 'antd'
import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'

export default function HospitalShow() {
   let {hoscode}  =  useParams()
 
   
//    存储医院数据
let [hospital,setHospital] = useState<HospitalSh>()
let [yuyue,setyuyue]  = useState<bookingRule>()
    // 获取医院详情数据
    let getHospitalValue = async ()=>{
      let res = await  getHospitalItem(hoscode as string)   
      setHospital(res.hospital)  
      setyuyue(res.bookingRule)

    }
    // 模拟生命周期
    useEffect(()=>{
        getHospitalValue()
    },[])
  return (
    <Card>
                <Descriptions title="基本信息" bordered column={3}>
                    <Descriptions.Item label="医院名称" style={{ width: 200 }} span={1}>{hospital?.hosname}</Descriptions.Item>
                    <Descriptions.Item label="医院logo" span={2}>{<img style={{ width: 150 }} src={hospital?.logoData && `data:image/jpeg;base64,${hospital?.logoData}`} alt='' />}</Descriptions.Item>
                    <Descriptions.Item label="医院编码" span={1}>{hospital?.hoscode}</Descriptions.Item>
                    <Descriptions.Item label="医院地址" span={2}>{hospital?.param.fullAddress}</Descriptions.Item>
                    <Descriptions.Item label="坐车路线" span={3}>
                        {hospital?.route}
                    </Descriptions.Item>
                    <Descriptions.Item label="医院简介" span={3}>{hospital?.intro}</Descriptions.Item>
                </Descriptions>

                    <Descriptions title="预约规则信息" bordered className='mt' column={3}>
                        <Descriptions.Item label="预约周期" span={1}>{yuyue?.cycle}</Descriptions.Item>
                        <Descriptions.Item label="放号时间" span={2}>{yuyue?.releaseTime}</Descriptions.Item>
                        <Descriptions.Item label="停挂时间" span={1}>{yuyue?.stopTime}</Descriptions.Item>
                        <Descriptions.Item label="退号时间" span={2}>{yuyue?.quitTime}</Descriptions.Item>
                        <Descriptions.Item label="预约规则" span={3}>
                          {yuyue?.rule}
                        </Descriptions.Item>

                    </Descriptions>
    </Card>
  )
}

